from django_filters.filters import Filter

class MyFilter(Filter):
    def filter_queryset(self, request, queryset, view):
        param = request.query_params.get("ids")
        ids = param if param else request.query_params.get("id")
        if not ids:
            return queryset
        try:
            data = queryset.filter(id__in=[int(id) for id in ids.split(',')])
        except Exception as e:
            return None
        return data